<template>
  <div>
<!--  会员中心-->
    <div style=" width: 100%; height: 900px; background-size:cover;">
      <div style="padding-top: 180px;">
        <div class="login-box">
          <div class="login-title">登录</div>
          <div class="login-form">
            <form action="./member/login/" id="form" onsubmit="return login(this);">
              <!--账户名-->
              <div class="form-item user">
                <div class="form-ctrl">
                  <!-- <input type="text" id="userMail" name="username" value="" placeholder="昵称/手机/邮箱"
                      style="vertical-align:top"> -->
                  <input type="text" name="username" required="" id="username" class="form-control" placeholder="请输入登录用户名/邮箱/手机号码">
                </div>
              </div>

              <!--密码-->
              <div class="form-item pass">
                <div class="form-ctrl">
                  <!-- <input type="password" id="userPassword" name="password" value="" placeholder="请输入密码"> -->
                  <input type="password" name="password" required="" id="password" class="form-control" placeholder="请输入登录密码">
                </div>
              </div>

              <!--验证码-->

              <div class="form-item pass">
                <div class="form-ctrl">
                  <input type="text" name="checkcode" required="" id="checkcode" class="form-control" placeholder="请输入验证码" style="float: left; width: 60%;">
<!--                  <img title="点击刷新" style="height:48px;" id="codeimg" src="member_files/code.php" onclick="this.src=&#39;/core/code.php?&#39;+Math.round(Math.random()*10);">-->
<!--                  <img title="点击刷新" style="height:48px;" id="codeimg" src="member_files/code.php" onclick="this.src=code.php?&#39;+Math.round(Math.random()*10);">-->
                  <img title="点击刷新" style="height: 48px;" id="codeimg" :src="captchaSrc" @click="refreshCaptcha">
                </div>
              </div>


              <!--记住密码-->
              <div class="form-item box">
                <div class="rememb">
                  <div class="checkbox-group">
                    <input type="checkbox" checked="checked" id="save_pass" class="isRemberPass">
                    <label for="save_pass" class="checkbox">记住密码</label>
                  </div>
                </div>
              </div>

              <!--登录按钮-->
              <div class="form-item form-button">
                <button type="submit" class="btn btn-green block btn-login">登录 </button>
              </div>

            </form>
          </div>
        </div>
      </div>

    </div>
  </div>
</template>

<script>
import "@/assets/styles/animate.min.css";
import "@/assets/styles/lhcommon.css";
import "@/assets/styles/login.css";

export default {
  data() {
    return {
      captchaSrc: '/code.php'
    };
  },
  mounted() {
    this.refreshCaptcha();
  },
  methods: {
    refreshCaptcha() {
      this.captchaSrc = `/code.php?${Math.round(Math.random() * 10)}`;
      console.log(this.captchaSrc)
    }
  }
//   //ajax登录
//   function login(obj) {
//   var url = '/member/login/';
//   var username = $(obj).find("#username").val();
//   var password = $(obj).find("#password").val();
//   var checkcode = $(obj).find("#checkcode").val();
//
//   $.ajax({
//     type: 'POST',
//     url: url,
//     dataType: 'json',
//     data: {
//       username: username,
//       password: password,
//       checkcode: checkcode
//     },
//     success: function (response, status) {
//       if (response.code) {
//         alert("登录成功！");
//         location.href = response.tourl;
//       } else {
//         $('#codeimg').click();
//         alert(response.data);
//       }
//     },
//     error: function (xhr, status, error) {
//       alert('返回数据异常！');
//     }
//   });
//   return false;
// }

};

</script>
<style>
#baiduMap img {
  width: auto !important;
  min-width: 200% !important;
}
</style>
